package com.teradata;

import com.teradata.servlet.HelloCodeServlet;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;


/**
 * @SpringBootApplication = @Configuration + @ComponentScan + @EnableAutoConfiguration
 *                          配置             扫描注册为Bean     根据增加的java依赖，自动配置
 */

@EnableTransactionManagement
@ServletComponentScan
@SpringBootApplication
@MapperScan(value = "com.iLearn.mapper")
@EnableCaching
public class Start {

    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        return new ServletRegistrationBean<>(new HelloCodeServlet(),"/xiaohong");
    }

    public static void main(String[] args) {
        SpringApplication.run(Start.class, args);
    }
}
